#include<stdio.h>
#include"ohos_init.h"
#include "cmsis_os2.h"
#include "buzzer.h"

void myfunc(void *arg)
{
    buzzer_init();
    while(1)
    {
        buzzer_on(4);
        sleep(1);
        buzzer_off();    
        sleep(1);
    }
}

//main函数
void mytest(void)
{
    osThreadAttr_t attr;
    osThreadId_t id;

    attr.name="mytest";
    attr.cb_mem=NULL;
    attr.cb_size=0;
    attr.stack_mem=NULL;
    attr.stack_size=1024;
    attr.attr_bits=0;
    attr.priority=osPriorityNormal;
//创建线程

    id=osThreadNew(myfunc,NULL,&attr);
    if(id==NULL)
    {
        printf("Create Thread failed.\n");
        return;
    }
    printf("Create Thread failed.\n");

}
SYS_RUN(mytest);